import { ajaxService } from '@/utils/request';
import {
  gainsingleRole,
  gainRole,
  AddRole,
  medicalRole,
} from '@/api/home/type';

const env = import.meta.env;
let baseURL = env.VITE_STAFF_URL;

/* 岗位管理   */

// 获取所有角色
export function gainRole() {
  return ajaxService({
    url: '/staff/role/getAll',
    method: 'get',
    baseURL,
  });
}

// 获取单个角色
export function gainsingleRole(params: gainsingleRole) {
  return ajaxService({
    url: '/staff/role/get',
    params,
    method: 'get',
    baseURL,
  });
}

// 添加角色
export function AddRole(data: AddRole) {
  return ajaxService({
    url: '/staff/role/add',
    data,
    method: 'post',
    baseURL,
  });
}

// 修改角色
export function medicalRole(data: medicalRole) {
  return ajaxService({
    url: '/staff/role/mod',
    data,
    method: 'put',
    baseURL,
  });
}

// 删除角色
export function delRole(params: medicalRole) {
  return ajaxService({
    url: '/staff/role/del',
    params,
    method: 'delete',
    baseURL,
  });
}

// 修改角色状态
export function putRoleState(data: any) {
  return ajaxService({
    url: '/staff/role/state',
    data,
    method: 'put',
    baseURL,
  });
}
